<?php

##############################
#   Database configuration   #
##############################

// Database DSN, consult http://www.php.net/manual/en/pdo.drivers.php
$dbdsn='mysql:host=localhost;dbname=syslog';
// Database user
$dbuser='syslog_ro';
// Database password
$dbpass='***';
// Database table
$dbtable = 'message';
// Maximum items on autolist
$dbmaxlist = 25;
// Maximum results in any case
$dbmaxresults = 200;

########################
#   Database mapping   #
########################

// Timestamp column
$dbitem[0] = array( 'column'=>"datetime", 'label'=>"Timestamp", 'type'=>"TIMESTAMP", 'autofilter'=>0 );

// Host column, use autolist for less than 20 hosts
$dbitem[1] = array( 'column'=>"host", 'label'=>"Host", 'type'=>"AUTOLIST", 'autofilter'=>1 );

// Facility column, use autolist
$dbitem[2] = array( 'column'=>"facility", 'label'=>"Facility", 'type'=>"AUTOLIST", 'autofilter'=>1 );

// Priority column, defined list
$dbitem[3] = array( 'column'=>"level", 'label'=>"Priority", 'type'=>"LIST", 'autofilter'=>1,
	'list'=> array(
		'emerg' =>    array( 'label'=> "Emergency",         'class'=> "c_level_emerg",  'where'=> "='emerg'" ),
		'alert+' =>   array( 'label'=> "Alert -> Emerg",    'class'=> "c_level_alert",  'where'=> "IN('emerg','alert')" ), 
		'alert' =>    array( 'label'=> "Alert",             'class'=> "c_level_alert",  'where'=> "='alert'"    ),
		'crit+' =>    array( 'label'=> "Critical -> Emerg", 'class'=> "c_level_crit",   'where'=> "IN('emerg','alert','crit')" ),
		'crit' =>     array( 'label'=> "Critical",          'class'=> "c_level_crit",   'where'=> "='crit'"     ),
		'err+' =>     array( 'label'=> "Error -> Emerg",    'class'=> "c_level_err",    'where'=> "IN('emerg','alert','crit','err')" ),
		'err' =>      array( 'label'=> "Error",             'class'=> "c_level_err",    'where'=> "='err'"      ),
		'warning+' => array( 'label'=> "Warning -> Emerg",  'class'=> "c_level_warn",   'where'=> "IN('emerg','alert','crit','err','warning')" ),
		'warning' =>  array( 'label'=> "Warning",           'class'=> "c_level_warn",   'where'=> "='warning'"  ),
		'notice+' =>  array( 'label'=> "Notice -> Emerg",   'class'=> "c_level_notice", 'where'=> "IN('emerg','alert','crit','err','warning','notice')" ),
		'notice' =>   array( 'label'=> "Notice",            'class'=> "c_level_notice", 'where'=> "='notice'"   ),
		'info+' =>    array( 'label'=> "Info -> Emerg",     'class'=> "c_level_info",   'where'=> "IN('emerg','alert','crit','err','warning','notice','info')" ),
		'info' =>     array( 'label'=> "Info",              'class'=> "c_level_info",   'where'=> "='info'"     ),
		'debug+' =>   array( 'label'=> "Debug -> Emerg",    'class'=> "c_level_debug",  'where'=> "IN('emerg','alert','crit','err','warning','notice','info','debug')" ),
		'debug' =>    array( 'label'=> "Debug",             'class'=> "c_level_debug",  'where'=> "='debug'"    ),
		'none' =>     array( 'label'=> "none",              'class'=> "c_level_none",   'where'=> "='none'"     )
	)
);

// Program column
$dbitem[4] = array( 'column'=>"program", 'label'=>"Program", 'type'=>"PARTIALMATCH", 'size'=>16, 'autofilter'=>1 );

// PID column
$dbitem[5] = array( 'column'=>"pid", 'label'=>"PID", 'type'=>"EXACTMATCH", 'size'=>5, 'autofilter'=>1 );

// Message column
$dbitem[6] = array( 'column'=>"message", 'label'=>"Message", 'type'=>"REGEXMATCH", 'size'=>30, 'autofilter'=>0 );


#################
#   Interface   #
#################

// Shortcuts to define time interval to use in JSON notation
// { "label":"Button name", "title":"Title to display on mouse hover", "value":value in seconds },
//	start date & time is set to max(start,(now - value))
$conf_resets = '
	{ "label":"All", "title":"Reset to max range",     "value":9999900000 },
	{ "label":"3m",  "title":"Reset to last 3 month",  "value":8035200 },
	{ "label":"1m",  "title":"Reset to last month",    "value":2678400 },
	{ "label":"2w",  "title":"Reset to last 2 weeks",  "value":1209600 },
	{ "label":"1w",  "title":"Reset to last week",     "value":604800 },
	{ "label":"3d",  "title":"Reset to last 3 days",   "value":259200 },
	{ "label":"24h", "title":"Reset to last 24 hours", "value":86400 },
	{ "label":"8h",  "title":"Reset to last 8 hours",  "value":28800 },
	{ "label":"4h",  "title":"Reset to last 4 hours",  "value":14400 },
	{ "label":"1h",  "title":"Reset to last 1 hour",   "value":3600 }
';

// Drop down list with number of lines to display
$conf_lines = array( 10, 20, 50, 100, 200 );
